﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ArchitectingInnovation.PRISMvvM.Core.Converters
{
    public class EnumKeyValue
    {
        public EnumKeyValue(object enumValue)
        {
            this.Value = enumValue;
        }

        public override string ToString()
        {
            if (String.IsNullOrEmpty(this.Name))
                return " ";
            return this.Name;
        }

        public override int GetHashCode()
        {
            if (this.Name == null)
                return 1;
            return this.Name.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var v = obj as EnumKeyValue;
            if (v == null)
                return false;
            return this.Name == v.Name;
        }

        public string Name
        {
            get
            {
                if (Value == null)
                    return null;
                return Enum.GetName(Value.GetType(), Value);
            }
        }

        public object Value { get; set; }
    }
}
